package cn.com.customer.manager.bean

import android.os.Parcel
import android.os.Parcelable

/**
 * ============================================
 */
data class VersionInfo(var versionCode: Int,
                       var versionName: String,
                       var versionDesc: String,
                       var versionUrl: String,
                       var isMustUpgrade: Char) : Parcelable {
    constructor(source: Parcel) : this(
            source.readInt(),
            source.readString(),
            source.readString(),
            source.readString(),
            source.readByte().toChar()
    )

    override fun describeContents() = 0

    override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
        writeInt(versionCode)
        writeString(versionName)
        writeString(versionDesc)
        writeString(versionUrl)
        writeByte(isMustUpgrade.toByte())
    }

    companion object {
        @JvmField
        val CREATOR: Parcelable.Creator<VersionInfo> = object : Parcelable.Creator<VersionInfo> {
            override fun createFromParcel(source: Parcel): VersionInfo = VersionInfo(source)
            override fun newArray(size: Int): Array<VersionInfo?> = arrayOfNulls(size)
        }
    }
}